﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<script language="JavaScript" type="text/javascript" src="{res file=js/lan.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
<link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
<script language="javascript" type="text/javascript">
$(function() {
$('th[type="order"]').click(function() {
var order = $(this).attr('field') + '-' + $(this).attr('order');
$('#order').val(order);
$('input[name="search"]').click();
}).css({'cursor': 'pointer', 'color': '#36c'});
var order = $('#order').val().split('-');
var field = $('th[type="order"][field="' + order[0] + '"]');
if (order[1] == 'ASC') {
field.attr('order', 'DESC').text(field.text() + '↑');
} else {
field.attr('order', 'ASC').text(field.text() + '↓');
}
if (order[0] != 'arrival_date') {
$('th[type="order"][field="arrival_date"]').attr('order', 'DESC');
}

$("#fabric_shop_id").change(function(){
var brand_id = $(this).val();
var url="index.php?app=sample&act=ajax_get_fabric_shop&id="+brand_id;

$.getJSON(url,function(ret){
	if(ret)
	{
		$("#factory_item option").remove();
		$("#factory_item").append('<option value=""></option>');
			$.each(ret, function(k, v) {
			$("#factory_item").append('<option value="'+v+'" >'+v+'</option>');
			});
	}
  });
  });
  
  
});
$(function(){
	//取消用户分配
	$('#cancel_batch').click(function(){
		if(confirm("您确定要取消全部的模板分配吗?")==true){
			window.location = "index.php?app=order&act=batch_cancel";
			return true;
		}else{
			return false;
		}
	});
	
	//取消展示订单
	$('#cancel_show').click(function(){
		if(confirm("您确定要取消全部的展示订单吗?")==true){
			window.location = "index.php?app=order&act=reveal_cancel";
			return true;
		}else{
			return false;
		}
	});
});
</script>
</head>
<body>
<div class="sub-body">
	<div id="head">
		<form action="index.php" method="get">
			<table width="80%" cellspacing="0" cellpadding="0" class="search">
				<tbody>
					<tr>
						<th width="120">{$lang.order_create_date}：</th>
						<td width="200"><input name="order_create_date" id="order_create_date" type="text" class="input-6"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" {if $c_time1}value="{$c_time1}"{/if}/>
							{$lang.to}
							<input name="order_create_date2" id="order_create_date2" type="text" class="input-6"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" {if $c_time1}value="{$c_time2}"{/if} /></td>
						<th width="120">{$lang.order_sn}：</th>
						<td width="200"><input type="text" id="order_sn" name="order_sn" class="input-1" /></td>
						<th width="100">{$lang.style_sn}：</th>
						<td width="200"><input type="text" id="style_sn" name="style_sn" class="input-1" /></td>
						<td width="100" rowspan="5"><input type="hidden" value="search" name="act"/>
							<input type="hidden" value="order" name="app" />
							<input type="hidden" name="order" id="order" value="{if $smarty.get.order}{$smarty.get.order}{else}order_create_date-DESC{/if}" />
							<input type="submit" value="{$lang.search}" class="inquiry"  name="search"/></td>
					</tr>
					<tr>
						<th>{$lang.brand_name}：</th>
						<td><select name="brand_id" id="brand_id" {if $user.role eq USER_FACTORY}disabled="disabled"{/if}>
								<option value="0"></option>
								<!--{foreach from=$brand_list item=brand key=k}-->
								<option value="{$brand.brand_id}">{$brand.brand_name}&nbsp;&nbsp;({$brand.company_name|escape})</option>
								<!--{/foreach}-->
							</select></td>
						<th>{$lang.buyer_name}：</th>
						<td><select name="buyer_id" id="buyer_id" {if $user.role eq USER_FACTORY}disabled="disabled"{/if}>
							<option value="0"></option>
							
							<!--{foreach from=$buyer_list item=buyer}-->
							
							<option value="{$buyer.user_id}">{$buyer.user_name}</option>
							
							<!--{/foreach}-->
							
							</select></td>
						<th>{$lang.merchandiser}：</th>
						<td><select name="merchandiser_id" id="merchandiser_id">
								<option value="0"></option>
								<!--{foreach from=$merchandiser_list item=merchandiser}-->
								<option value="{$merchandiser.user_id}" {if $merchandiser.user_id==$mer_id}selected{/if}>{$merchandiser.user_name}</option>
								<!--{/foreach}-->
							</select></td>
					</tr>
					<tr>
						<th>{$lang.factory_name}：</th>
						<td><select name="factory_id" id="factory_id" <!-- {if $user.role==USER_CLIENT} -->disabled<!-- {/if} -->>
					{if $user.role eq USER_FACTORY}
						<option value="{$user.factory_id}">{$user.factory_name}</option>
					{else}
						<option value="0"></option>
						<!--{foreach from=$factory_list item=factory}-->
						<option value="{$factory.factory_id}">{$factory.factory_name}</option>
						<!--{/foreach}-->
					{/if}
						</select></td>
						<th>{$lang.style_name}：</th>
						<td><select name="style_id" id="style_id">
								<option value="0"></option>
								<!--{foreach from=$styles item=style}-->
								<option value="{$style.style_id}">{$style.style_name}</option>
								<!--{/foreach}-->
							</select></td>
						<th>{$lang.status}：</th>
						<td><select name="status" id="status">
								<option value="-1"></option>
								<!--{foreach from=$lang.order_status item=os key=k}-->
								<!-- {if $user.role==USER_CLIENT} -->
								{if !in_array($k,array(5,6))}
								<option value="{$k}" {if $k == $smarty.get.status}selected{/if}>{$os}</option>
								{/if}
								<!-- {elseif $k!=6} -->
								<option value="{$k}" {if $k == $smarty.get.status or $k==$status}selected{/if}>{$os}</option>
								<!-- {/if} -->
								<!--{/foreach}-->
							</select></td>
					</tr>
					<tr>
						<th>{$lang.ref_sample}：</th>
						<td width="200"><input type="text" id="sample_sn" name="sample_sn" class="input-1" /></td>
						<!-- {if $user.role!=USER_CLIENT} -->
						<th>工厂入仓日期：</th>
						<td><input type="text" class="input-6" name="release_date" id="release_date"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
							至
							<input type="text" class="input-6" name="release_date2" id="release_date2"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" /></td>
						<th>分配买手：</th>
                         <td>
                         <select name="assign_buyer" id="assign_buyer" {if $user.role eq USER_FACTORY}disabled="disabled"{/if}>
							<option value="0"></option>
							
							<!--{foreach from=$buyer_list item=buyer}-->
							
							<option value="{$buyer.user_id}">{$buyer.user_name}</option>
							
							<!--{/foreach}-->
							
							</select></td>
						<!-- {else} -->
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
						<!-- {/if} -->
					</tr>
					<!-- {if $user.role!=USER_CLIENT} -->
					<tr> 
                    <th>布行/档口：</th>
						<td><select name="fabric_shop_id" id="fabric_shop_id">
								<option value="0"></option>
								<!--{foreach from=$fabrics item=fabric}-->
								<option value="{$fabric.fabric_shop_id}">{$fabric.fabric_shop_name}</option>
								<!--{/foreach}-->
							</select></td>
                      <th>品名货号：</th>
						<td><select name="factory_item" id="factory_item">
								<option value="0"></option>
								<!-- {foreach from=$color_card_info_list item=color_card_list} -->
						<option value="{$color_card_list.item}" {if $color_card_list.item eq $factory_item} selected="selected" {/if}>{$color_card_list.item}</option>
						<!-- {/foreach} -->
							</select></td>    
                            <th>质检：</th>  
                            <td>
                            	<select name="qc_id" id="qc_id">
								<option value="0"></option>
								<!-- {foreach from=$qc_list item=qcs} -->
									<option value="{$qcs.user_id}" {if $qcs.user_id eq $smarty.get.qc_id} selected="selected" {/if}>{$qcs.user_name}</option>
								<!-- {/foreach} -->
								</select>
                            </td>
                            </tr>
                        <!-- {/if} -->
				</tbody>
			</table>
		</form>
		<script>
<!--{if $role==USER_CLIENT}-->
$('#buyer_id option:first-child').remove();
$('#buyer_id').val('{$user.user_id}');
$('#buyer_id').attr('readonly','readonly');
<!--{/if}-->
</script> 
	</div>
	<div class="tab_info">
		<div class="tab-title-1"><span>{$lang.order_search_list}</span></div>
		<table width="100%" cellspacing="0" cellpadding="0" id="tab-color2" class="tab-display">
			<tbody>
				<tr>
					<!-- {if ($user.role==USER_MERCHANDISER && $user.role_cate==ROLE_MERCH) ||  $user.role==USER_MANAGER} -->
			      	<th width="3%"><input type="checkbox" class="checkall" /></th>
			      	<!-- {/if} -->
					<th width="3%">{$lang.No}</th>
					<th width="7%" type="order" field="order_create_date" order="ASC">{$lang.order_create_date}</th>
					<th width="9%" type="order" field="order_sn" order="ASC">{$lang.order_sn}</th>
					<th width="7%"  type="order" field="style_sn" order="ASC">{$lang.style_sn}</th>
					<th width="7%" type="order" field="brand_name" order="ASC">{$lang.brand_name}</th>
					<th width="7%" type="order" field="buyer_name" order="ASC">{$lang.buyer_name}</th>
					<th width="7%" type="order" field="merchandiser" order="ASC">{$lang.merchandiser}</th>
					<th width="7%">图片</th>
					<!-- {if $user.role neq USER_CLIENT && $user.role neq USER_FACTORY && $user.role neq USER_MERCHANT} -->
					<th width="7%">细节图</th>
					<!-- {/if} -->
					<!-- {if $user.role==USER_CLIENT} -->
					<th width="7%" type="order" field="buyer_arrival_date" order="ASC">{$lang.buyer_arrival_date}</th>
					<!-- {else} -->
					<th width="7%" type="order" field="factory_name" order="ASC">工厂</th>
					<th width="7%" type="order" field="release_date" order="ASC">工厂入仓日期</th>
					<!-- {/if} -->
                    <th width="6%" type="order" field="status" order="ASC">{$lang.status}</th>
                    <!-- {if ($user.role==USER_MERCHANDISER && $user.role_cate==ROLE_MERCH) ||  $user.role==USER_MANAGER} -->
					<th width="5%" type="order" field="is_preset" order="ASC">系统订单</th>
					<!-- {/if} -->
					<!-- {if $user.role eq USER_CLIENT} -->
					<th width="7%">{$lang.packedit}</th>
					<!-- {/if} -->
				</tr>
				<!--{foreach from=$orders item=order name=o}-->
				<tr style="height: 80px">
					<!-- {if ($user.role==USER_MERCHANDISER && $user.role_cate==ROLE_MERCH) ||  $user.role==USER_MANAGER} -->
			      	<td><input type="checkbox" class="checkitem" value="{$order.order_id}" /></td>
			        <!-- {/if} -->
					<td>{$smarty.foreach.o.iteration}</td>
					<td>{$order.order_create_date|date}</td>
					<!-- {if $user.role==USER_CLIENT} -->
					<td><a href="{url app=order&act=consumer_edit&id=$order.order_id&handle=view}"  style="color:blue">{$order.order_sn|default:-}</a></td>
					<!-- {else} -->
					<td><a href="{url app=order&act=view&id=$order.order_id}"  style="color:blue">{$order.order_sn|default:-}</a></td>
					<!-- {/if} -->
					<td>{$order.style_sn}</td>
					<td>{$order.brand_name}</td>
					<td>{$order.buyer_name}</td>
					<td>{$order.merchandiser}</td>
					<td><a href="{$site_url}/{$order.front_pic}" target="_blank"><img src="{$order.front_pic}" width="80" style="border:none;" alt="图片"/></a></td>
					<!-- {if $user.role neq USER_CLIENT && $user.role neq USER_FACTORY && $user.role neq USER_MERCHANT} -->
					<td><a href="{$site_url}/{$order.default_image}" target="_blank"><img src="{$order.default_image}" width="80" style="border:none;" alt="细节图"/></a></td>
					<!-- {/if} -->
					<!-- {if $user.role==USER_CLIENT} -->
					<td>{$order.buyer_arrival_date|date}</td>
					<!-- {else} -->
					<td>{$order.factory_name}</td>
					<td>{$order.release_date|date}</td>
					<!-- {/if} -->
                    <td>{$lang.order_status.$order.status}</td>
                    <!-- {if ($user.role==USER_MERCHANDISER && $user.role_cate==ROLE_MERCH) ||  $user.role==USER_MANAGER} -->
					<td><!--{if $order.is_preset}-->{$lang.yes}<!--{else}-->{$lang.no}<!--{/if}--></td>
					<!-- {/if} -->
					<!-- {if $user.role eq USER_CLIENT} -->
					<td><a href="{url app=order&act=packedit&order_id=$order.order_id}">查看</a></td>
					<!-- {/if} -->
				</tr>
				<!--{/foreach}-->
			</tbody>
		</table>
		<!-- {if $orders} -->
         <div id="batchAction" style="padding-top: 10px">
	  	  <!-- {if ($user.role==USER_MERCHANDISER && $user.role_cate==ROLE_MERCH) ||  $user.role==USER_MANAGER} -->
		   <input class="btn-2 batchButton" type="button" value="{$lang.assign_sys_order}" name="id" uri="index.php?app=order&act=batch_edit" />&nbsp;&nbsp;
		   <input class="btn-2" type="button" value="取消全部用户分配" id="cancel_batch" />&nbsp;&nbsp;
		   <!-- {if $cancel_user} -->
		   <input class="btn-2 batchButton" type="button" value="{$lang.cancel_user_show}" name="id" uri="index.php?app=order&act=cancel_user_assign&uid={$cancel_user}" presubmit="confirm('{$lang.cancel_confirm}');" />&nbsp;&nbsp;
		   <!-- {/if} -->
		   <input class="btn-2 batchButton" type="button" value="{$lang.sys_order_assign}" name="id" uri="index.php?app=order&act=assign_sys_order" />&nbsp;&nbsp;
		   <input class="btn-2" type="button" value="取消展示订单" id="cancel_show" />
		  <!-- {/if} -->
  		</div>
  		<!-- {/if} -->
  		<div class="page"> {include file=page.html} </div>
	</div>
</div>
<script language="JavaScript" type="text/javascript" src="{res file=js/tab_color.js}"></script> 
<script language="JavaScript">
$(function(){
//$('table.tab-add  tr:nth-child(odd)').css('backgroundColor',"#f4f8fa");
});
<!--{if $search}-->
$(function(){
var get_para={$get_para};
$.each(get_para,function(k,v){
if($('#'+k)){
$('#'+k).attr('value', v);
}
})
});
<!--{/if}-->
</script>
</body>
{$async_sendmail}
</html>
